import request from '@/utils/request'

export function getOrgList() {
  return request({
    url: '/deploy/orgList',
    method: 'post',
    data: '',
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}

export function getorgChannelList() {
  return request({
    url: '/deploy/orgChannelList',
    method: 'post',
    data: '',
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}

export function deleteOrg(row) {
  let data = {
    "name": row.name,
    "domain": row.domain,
    "type": row.type,
    "hosts": row.hosts
  };
  return request({
    url: '/deploy/delOrg',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}

export function addOrg(row) {
  let data = {
    "name": row.name,
    "domain": row.domain,
    "type": row.type,
    "host": row.host,
    "hosts": row.hosts
  };
  return request({
    url: '/deploy/addOrg',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}

export function alertOrg(oldOrg, newOrg) {
  let data = []
  console.log(oldOrg, newOrg);
  data.push(oldOrg)
  data.push(newOrg)
  return request({
    url: '/deploy/alertOrg',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}
